package com.cloudream.core.impl;

import com.cloudream.core.dto.InfoDTO;
import com.cloudream.core.mapper.InfoMapper;
import com.cloudream.core.service.InfoService;
import com.cloudream.core.utils.Pager;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

@Repository("infoService")
public class InfoServiceImpl implements InfoService {

    @Resource(name = "infoMapper")
    InfoMapper infoMapper;

    public int add(InfoDTO dto) {
        return infoMapper.insert(dto);
    }

    public List getAll() {
        Pager pager = new Pager().max();
        pager.setSorts(InfoMapper.ORDERBY);
        return infoMapper.list(pager, new HashMap());
    }
}
